import Vue from 'vue'
import  VueRouter from 'vue-router'
//安装插件
Vue.use(VueRouter)
// 路由懒加载
const Home = ()=>import ('../views/home/Home.vue');
const Cart = ()=>import ('../views/shopcart/Shopcart.vue');
const Category = ()=>import ('../views/category/Category.vue');
const Profile = ()=>import ('../views/profile/Profile.vue');
const Detail = () => import('../views/detail/Detail.vue')

//路由信息

const routes=[
  {
    path:'',
    redirect:'/home'
  },
  {
    path:'/home',
    component:Home,
    
  },
  {
    path:'/cart',
    component:Cart,
  },
  {
    path:'/category',
    component:Category,
  },
  {
    path:'/profile',
    component:Profile,
  },
  {
    path:"/detail",
    component:Detail,
  }
];
//配置路由
const router = new VueRouter({
  routes,
  mode:'history',
})

export default router